/** 表单验证配置 */

// 登录用户名密码自定义验证
const userName = (rule, value, callback) => {
  if (value === null || value === "") {
    callback(new Error("请输入正确的用户名"));
  } else {
    callback();
  }
};
const userPassWord = (rule, value, callback) => {
  if (value === null || value === "") {
    callback(new Error("密码不能为空"));
  } else {
    callback();
  }
};

const validate = {
  // 登录用户名密码自定义验证
  username: [{ required: true, validator: userName, trigger: "blur" }],
  password: [{ required: true, validator: userPassWord, trigger: "blur" }]
};

export default validate;
